use self::job::{Job, Work};
use self::job_queue as jq;
use self::job_queue::JobQueue;
-use self::context::{Context, PlatformRequirement, PlatformTarget};
-use self::context::{PlatformPlugin, PlatformPluginAndTarget};
pub use self::compilation::Compilation;
pub use self::context::Context;
name = "foo"
doctest = false
"#)
- .file("src/lib.rs", "")
+ .file("src/lib.rs", r#"
+ #[cfg(test)] extern crate bar;
+ #[cfg(not(test))] fn foo() { env!("FOO"); }
+ "#)
.file("bar/Cargo.toml", r#"
[package]
"#)
.file("bar/src/lib.rs", "pub fn bar() {}");
p.build();
- assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
+ assert_that(p.process(cargo_dir().join("cargo")).arg("build")
+ .env("FOO", Some("bar")),
execs().with_status(0)
.with_stdout(format!("{} foo v0.5.0 ({})\n",
COMPILING, p.url())));
- p.root().move_into_the_past().assert();
-
- // Now that we've built the library, it *should not* be built again as part
- // of `cargo test`, even if we have some dev dependencies that weren't
- // previously built.
- File::create(&p.root().join("src/lib.rs")).write_str(r#"
- #[cfg(test)] extern crate bar;
- #[cfg(not(test))] fn foo() { bar(); }
- "#).unwrap();
- p.root().join("src/lib.rs").move_into_the_past().assert();
assert_that(p.process(cargo_dir().join("cargo")).arg("test"),
execs().with_status(0)
// Currently the only cross compilers available via nightlies are on linux/osx,
// so we can only run these tests on those platforms
-#![cfg(target_os = "linux")]
-#![cfg(target_os = "macos")]
+#![cfg(any(target_os = "linux", target_os = "macos"))]
use std::os;
use std::path;
", compiling = COMPILING, running = RUNNING,
dir = p.url()).as_slice()));
})
+
+test!(almost_cyclic_but_not_quite {
+ let p = project("a")
+ .file("Cargo.toml", r#"
+ [package]
+ name = "a"
+ version = "0.0.1"
+ authors = []
+
+ [dev-dependencies.b]
+ path = "b"
+ [dev-dependencies.c]
+ path = "c"
+ "#)
+ .file("src/lib.rs", r#"
+ #[cfg(test)] extern crate b;
+ #[cfg(test)] extern crate c;
+ "#)
+ .file("b/Cargo.toml", r#"
+ [package]
+ name = "b"
+ version = "0.0.1"
+ authors = []
+
+ [dependencies.a]
+ path = ".."
+ "#)
+ .file("b/src/lib.rs", r#"
+ extern crate a;
+ "#)
+ .file("c/Cargo.toml", r#"
+ [package]
+ name = "c"
+ version = "0.0.1"
+ authors = []
+ "#)
+ .file("c/src/lib.rs", "");
+
+ assert_that(p.cargo_process("build"), execs().with_status(0));
+ assert_that(p.process(cargo_dir().join("cargo")).arg("test"),
+ execs().with_status(0));
+})